﻿using ATEDiagnoser;
using QRCoder;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AteCapybara
{
    public class GetQRCode
    {
        public static Bitmap Proudce(string Info)
        {
            try
            {
                string level = "L";
                QRCodeGenerator.ECCLevel eccLevel = (QRCodeGenerator.ECCLevel)(level == "L" ? 0 : level == "M" ? 1 : level == "Q" ? 2 : 3);
                using (QRCodeGenerator qrGenerator = new QRCodeGenerator())
                {
                    using (QRCodeData qrCodeData = qrGenerator.CreateQrCode(Info, eccLevel))
                    {
                        using (QRCode qrCode = new QRCode(qrCodeData))
                        {
                            // return qrCode.GetGraphic(20, Color.Black, Color.White,
                            // new Bitmap(".\\pic\\20240828135912.ico"), (int)15);
                            return qrCode.GetGraphic(20, Color.Black, Color.White,true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MsgShow.Error(e.Message);
                return null;
            }
            
        }
    }
}
